﻿using Cl.Entity.DataBaseEntity.Goods;
using Cl.Model.DataBaseEntityDtos.Goods.GoodsGroup;
using Cl.Utils.Helper.AutoMap;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace Cl.Model.DataBaseEntityDtos.Shops.BaseShop
{
    public class BaseShopOutputDto
    {
        public BaseShopOutputDto() { }
        public BaseShopOutputDto(Entity.DataBaseEntity.Shops.BaseShop info)
        {
            //自动映射到当前对象
            AutoMapHelper.MapTo(info, this);
            if (info.BaseGoodsList != null && info.BaseGoodsList.Count > 0)
            {
                foreach (var item in info.BaseGoodsList)
                {
                    this.GoodsList.Add(new BaseShopHomeGoodsOutputDto(item)
                    {

                    });
                }
            }

            if (info.GoodsGroupList != null)
            {
                GroupList = info.GoodsGroupList.Select(s => new GoodsGroupOutputDto(s) { }).ToList();
            }

        }

        public List<GoodsGroupOutputDto> GroupList { get; set; } = new List<GoodsGroupOutputDto>();

        public int Id { get; set; }
        public string Title { get; set; } = string.Empty;

        public string Description { get; set; } = string.Empty;

        public string Address { get; set; } = string.Empty;

        /// <summary>
        /// 营业执照
        /// </summary>
        public string BusinessLicensePath { get; set; } = string.Empty;

        public string IdCardFrontPath { get; set; } = string.Empty;

        public string IdCardBackPath { get; set; } = string.Empty;

        /// <summary>
        /// 多个图片用,隔开存储；
        /// </summary>
        public string ShopPicturePath { get; set; } = string.Empty;

        public DateTime AuditTime { get; set; }

        public int AuditUserId { get; set; }

        /// <summary>
        /// 营业时间
        /// </summary>
        public string BusinessHours { get; set; } = string.Empty;

        /// <summary>
        /// 是否营业
        /// </summary>
        public bool IsOpenBusiness { get; set; }

        /// <summary>
        /// 管理员审批后可以正常使用
        /// </summary>
        public string AuditState { get; set; } = string.Empty;

        public string AuditRemark { get; set; } = string.Empty;

        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 评分
        /// </summary>
        public string Mark { get; set; } = "4.8";

        public decimal MonthlySales { get; set; } = 200;

        public List<BaseShopHomeGoodsOutputDto> GoodsList { get; set; } = new List<BaseShopHomeGoodsOutputDto>();
    }

    public class BaseShopHomeGoodsOutputDto
    {
        public BaseShopHomeGoodsOutputDto() { }

        public BaseShopHomeGoodsOutputDto(BaseGoods Info)
        {
            id = Info.Id;
            type_id = Info.GroupId;
            name = Info.Title;
            img = Info.Cover;
            price = Info.Price;
            descripe = Info.Description;
            Tag = Info.Tag;
        }

        public int id { get; set; }
        public int type_id { get; set; }

        public string name { get; set; }
        public string img { get; set; }

        public string Tag { get; set; }

        public decimal price { get; set; }
        public string descripe { get; set; }
        //    //现价
        //    price: 45,
        ////原价
        //old_price: 65,

    }
}
